<page-header />

<div nz-row>
  <div nz-col nzSpan="4">
    <nz-card nzTitle="资源组" [nzExtra]="groupTemplate">
      <nz-tree
        nzBlockNode
        [nzData]="groupInfo"
        nzShowLine
        [nzSelectedKeys]="selectedGroups"
        (nzClick)="groupClick($event)"
        nzVirtualHeight="660px"
      />
    </nz-card>
    <ng-template #groupTemplate>
      <button nz-button nzType="text" (click)="addGroup()">
        <nz-icon nzType="plus"></nz-icon>
      </button>
      @if (currentGroup.id) {
        <button nz-button nzType="text" (click)="editGroup()">
          <span nz-icon nzType="edit"></span>
        </button>
      }
    </ng-template>
  </div>
  <div nz-col nzSpan="20">
    <nz-card [nzExtra]="resourceTemplate" nzTitle="资源">
      <sf mode="search" [schema]="searchSchema" (formSubmit)="query($event)" (formReset)="st.reset($event)" />
      <st
        #st
        [data]="page.records"
        [columns]="columns"
        (change)="change($event)"
        [pi]="page.current"
        [ps]="page.size"
        [total]="page.total"
        [page]="pagination"
      />
    </nz-card>
    <ng-template #resourceTemplate>
      <nz-radio-group [(ngModel)]="currentResourceFilter" (ngModelChange)="query({ deleted: $event })" style="margin-right: 30px">
        <label nz-radio-button nzValue="">全部</label>
        <label nz-radio-button nzValue="false">启用</label>
        <label nz-radio-button nzValue="true">禁用</label>
      </nz-radio-group>
      <button nz-button nzType="primary" (click)="add()">添加</button>
    </ng-template>
  </div>
</div>
